package com.mxdx.edu.common;

/**
 * rest api 异常封装
 * 
 * @author wangyuan
 * @date 2016-11-24
 */
public class RestApiException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private final String errorCode;
    private final String notice;

    /**
     * 
     * @param errorCode 错误码
     * @param message 具体错误信息
     */
    public RestApiException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
        this.notice = "";
    }

    /**
     * 
     * @param errorCode 错误码
     * @param message 具体错误信息
     * @param notice 前端提示
     */
    public RestApiException(String errorCode, String message, String notice) {
        super(message);
        this.errorCode = errorCode;
        this.notice = notice;
    }

    /**
     * 
     * @param errorCode 错误码
     * @param message 具体错误信息
     * @param cause 捕获的异常
     */
    public RestApiException(String errorCode, String message, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
        this.notice = "";
    }

    /**
     * 
     * @param errorCode 错误码
     * @param message 具体错误信息
     * @param notice 前端提示
     * @param cause 捕获的异常
     */
    public RestApiException(String errorCode, String message, String notice, Throwable cause) {
        super(message, cause);
        this.errorCode = errorCode;
        this.notice = notice;
    }


    public String getErrorCode() {
        return this.errorCode;
    }

    public String getNotice() {
        return notice;
    }

}
